package com.gradle.quartz.batch.prestatement;

import com.gradle.bean.user.User;
import org.springframework.batch.item.database.ItemPreparedStatementSetter;
import org.springframework.stereotype.Component;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@Component
public class UserPreStatementSetter implements ItemPreparedStatementSetter<User> {

    @Override
    public void setValues(User item, PreparedStatement ps) throws SQLException {
        ps.setLong(1,item.getId());
        ps.setString(2,item.getUserName());
        ps.setInt(3,item.getAge());
        ps.setString(4,item.getAddress());
    }
}
